package com.sjgs.gis.service.mapper;


import com.sjgs.gis.domain.*;
import com.sjgs.gis.service.dto.NodePluginDTO;

import org.mapstruct.*;

/**
 * Mapper for the entity {@link NodePlugin} and its DTO {@link NodePluginDTO}.
 */
@Mapper(componentModel = "spring", uses = {NodeMapper.class})
public interface NodePluginMapper extends EntityMapper<NodePluginDTO, NodePlugin> {

    @Mapping(source = "node.id", target = "nodeId")
    NodePluginDTO toDto(NodePlugin nodePlugin);

    @Mapping(source = "nodeId", target = "node")
    NodePlugin toEntity(NodePluginDTO nodePluginDTO);

    default NodePlugin fromId(Long id) {
        if (id == null) {
            return null;
        }
        NodePlugin nodePlugin = new NodePlugin();
        nodePlugin.setId(id);
        return nodePlugin;
    }
}
